package many.to.many;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

//@Entity
public class Category implements java.io.Serializable {
 
	private static final long serialVersionUID = 8830388783928660605L;
	
	private Integer categoryId;
	private String name;
	private Set<Stock> stocks = new HashSet<Stock>(0);
 
	public Category() {
	}
 
	public Category(String name) {
		this.name = name;
	}
 
	public Category(String name, Set<Stock> stocks) {
		this.name = name;
		this.stocks = stocks;
	}
 
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getCategoryId() {
		return this.categoryId;
	}
 
	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}
 
	public String getName() {
		return this.name;
	}
 
	public void setName(String name) {
		this.name = name;
	}
 
	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "categories")
	public Set<Stock> getStocks() {
		return this.stocks;
	}
 
	public void setStocks(Set<Stock> stocks) {
		this.stocks = stocks;
	}
}


